﻿using System;
using System.ComponentModel.DataAnnotations;
using SilveR.Views.StatsViews;

namespace SilveR.GUIValidators
{
    public class NonParametricsGUIValidator
    {
        public static ValidationResult CheckStringVarSet(string variable, ValidationContext context)
        {
            return BasicGUIValidator.CheckStringVarSet(variable, context);
        }

        public static ValidationResult ValidateControlLevelSet(string control, ValidationContext context)
        {
            NonParametricVariables np = (NonParametricVariables)context.ObjectInstance;

            if (String.IsNullOrEmpty(control) && np.AnalysisType == NonParametricVariables.AnalysisOption.CompareToControl)
                return new ValidationResult("Control level is a required variable when comparing to control");
            else
                return ValidationResult.Success;
        }
    }
}
